# Contributor: Zhuo FENG <fenprace.i@gmail.com>
# Maintainer: Zhuo FENG <fenprace.i@gmail.com>
pkgname=clash
pkgver=1.10.6
pkgrel=0
pkgdesc="rule-based tunnel in go"
url="https://github.com/Dreamacro/clash"
arch="all"
license="GPL-3.0-or-later"
makedepends="go"
subpackages="$pkgname-openrc"
source="$pkgname-$pkgver.tar.gz::https://github.com/Dreamacro/clash/archive/refs/tags/v$pkgver.tar.gz
	clash.initd"
options="!check" # The upstream does not provide a proper way to test the pakcage

build() {
	export GOFLAGS="$GOFLAGS -modcacherw"
	export GOPATH="$builddir"/gopath
	make VERSION="v$pkgver" docker
}

package() {
	install -Dm755 bin/clash-docker "$pkgdir"/usr/bin/clash
	install -Dm755 "$srcdir"/clash.initd "$pkgdir"/etc/init.d/clash
}

sha512sums="
0bf72eaa90b90756599e5fad89f77c75695fb963463afad136e027b187a51bdd6ae8adcfe4f2fd43254ce16b1c9e67c7f9468a4cb981592f9975fd0b3a2f09a1  clash-1.10.6.tar.gz
e22dc344dbcd144b0fc0d77450da2a0cbc5e5f7ffaf01cd411610e00ca131ad18ef3f1b6191fa870bc2a27bdc67236c5e53aa5c9c6bc5f4a195d7f0ff04a7d35  clash.initd
"
